<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><?php echo C('SITE_TITLE');?></title>
<link href="/res/js/pikaday/css/pikaday.css"  rel="stylesheet" type="text/css" />
<link href="/res/css/index.css"  rel="stylesheet" type="text/css" />
<link href="/res/js/artDialog/ui-dialog.css"  rel="stylesheet" type="text/css" />
<script src="/res/js/jquery.js"></script>
<script src="/res/js/pikaday/moment.js"></script>
<script src="/res/js/pikaday/pikaday.js"></script>
<script src="/res/js/pikaday/plugins/pikaday.jquery.js"></script>
<script src="/res/js/artDialog/dialog-min.js"></script>
<script src="/res/js/template.js"></script>
<script src="/res/js/lib.js"></script>
<script src="/res/js/tool.js"></script>
</head>
<body>
<div id="header">
    <h1>广告联盟管理系统</h1>
    <ul>
        <li hide="4,5">提成：<span><?php echo getSiterServiceIncome(C('RUN_LOGIN_USER.uid'));?>元</span> ｜</li>
        <li id="viewHalfHourFlow" hide="3,4">30分结算：<span></span> ｜</li>
        <li>待审核：<a href="?m=Siter&status=0" hide="4">站长()</a> / 
        <a href="?m=Ader&status=0" hide="3">广告主()</a> /
        <a href="?m=Site&site_status=0" hide="4">网站()</a> ｜</li>
        <li><?php echo C('RUN_LOGIN_USER.user_name');?> 您好！
        <?php if(C('RUN_LOGIN_USER.last_login_time') == ''): ?>这是您第一次登陆
        <?php else: ?>
        上次登陆时间：<?php echo C('RUN_LOGIN_USER.last_login_time'); endif; ?>
        ｜
        </li>
        <!--<li><a href="#">短消息[10]</a></li>-->
        <li><a href="javascript:;" action="passwd">更改密码</a></li>
        <li><a href="javascript:;" action="logout">退出系统</a></li>
    </ul>
</div><!--/#header-->
<div id="main">
    <div id="nav">
        <div id="mainNav">
            <?php echo uiGetMainMenu();?>
        </div><!--/#mainNav-->
        <div id="subNav">
            <?php echo uiGetSubMenu();?>
        </div><!--/#subNav-->
    </div><!--/#nav-->
    <div id="spliter"></div><!--/#spliter-->
    <div id="zone">


<div id="zoneHeader">
    <h2>网站管理</h2>
</div><!--/#zoneHeader-->
<div id="zoneBody">
    <div id="zoneBodySearch">
        <form id="formSearch" action="?c=<?php echo (CONTROLLER_NAME); ?>">
            <input type="hidden" name="sort" />
            <input type="hidden" name="sortdir" />
            <ul>
                <li><b>
                    <select name="search_item_1">
                        <option value="id">网站编号</option>
                        <option value="uid">站长编号</option>
                        <option value="user_name">站长名称</option>
                    </select> ：</b>
                    <input type="text" name="search_item_val_1" class="fW100p" />
                </li>
                <li><b>网站名称：</b><input type="text" name="site_name" class="fW150p" /></li>
                <li><b>网址：</b><input type="text" name="site_domain" class="fW150p" /></li>
                <li>
                    <select name="status">
                        <option value="">网站状态</option>
                        <?php $_result=C('SITE_STATUS');if(is_array($_result)): $i = 0; $__LIST__ = $_result;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($key); ?>"><?php echo ($vo); ?></option><?php endforeach; endif; else: echo "" ;endif; ?>
                    </select>
                </li>
                <li><button type="button" id="as" class="btnSearch">查询</button></li>
                <li><button type="button" class="btnResetForm">清空表单</button></li>
            </ul>
        </form>
    </div><!--/#zoneBodySearch-->
    <div id="zoneBodyContent">
        <table class="table2">
            <thead>
                <tr>
                    <th class="tAr" width="100"><a href="javascript:;" sort="id">编号</a></th>
                    <th>UID</th>
                    <th>域名</th>
                    <th>状态</th>
                    <th>创建时间</th>
                    <th>备注</th>
                    <th class="tAction">&nbsp;</th>
                </tr>
            </thead>
            <tbody>
                <?php if(is_array($page["record"])): $i = 0; $__LIST__ = $page["record"];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><tr>
                    <td class="tAr"><?php echo ($vo["id"]); ?></td>
                    <td><?php echo ($vo["uid"]); ?></td>
                    <td><?php echo ($vo["domain"]); ?></td>
                    <td><?php echo (getSiteStatusCn($vo["status"])); ?></td>
                    <td><?php echo ($vo["create_time"]); ?></td>
                    <td><?php echo ($vo["comment"]); ?></td>
                    <td class="tAction">
                        <a href="?c=Site&a=modify&id=<?php echo ($vo["id"]); ?>">编辑</a>
                        <a href="?c=Site&a=del&id=<?php echo ($vo["id"]); ?>" t="firm" m="确认删除此网站吗？">删除</a>
                    </td>
                </tr><?php endforeach; endif; else: echo "" ;endif; ?>
            </tbody>
        </table>
    </div><!--/#zoneBodyContent-->
</div><!--/#zoneBody-->
<div id="zoneFooter"><?php echo W('Page/info', [$page]);?></div><!--/#zoneFooter-->
    </div><!--/#zone-->
</div><!--/#main-->
<div class="hide">
<div id="t-recharge-form">
<style>
.recharge-form {}
.recharge-form dd    { overflow:auto; }
.recharge-form label { float:left; }
.recharge-form label span { display:inline-block; color:#333; }
</style>
<dl class="dl2Col recharge-form">
    <dt>会员名称：</dt>
    <dd><input type="hidden" name="id"><input type="text" name="user_name" class="fW50"><span></span></dd>
    <dt g="money_type">对象：</dt>
    <dd g="money_type">
        <label><input type="radio" name="money_type" value="1"><span>日余额</span></label>
        <label><input type="radio" name="money_type" value="2"><span>周余额</span></label>
        <label><input type="radio" name="money_type" value="3"><span>月余额</span></label>
    </dd>
    <dt>方式：</dt>
    <dd>
        <label g="money_add"><input type="radio" name="type" checked="checked" value="1"><span>增加</span></label>
        <label g="money_deduct"><input type="radio" name="type" value="2"><span>扣除</span></label>
        <label g="money_pre"><input type="radio" name="type" value="3"><span>预充</span></label>
    </dd>
    <dt>金额：</dt>
    <dd><input type="text" name="money" class="fW30" /> 元</dd>
    <dt>备注：</dt>
    <dd><textarea name="comment" style="width:80%;height:50px;"></textarea></dd>
</dl>
</div>

<div id="tRechargeEditForm">
    <dl class="dl2Col">
        <dt>会员名称：</dt>
        <dd><input type="text" name="user_name" class="fW50" /><span></span></dd>
        <dt t="moneyType" class="hide">对象：</dt>
        <dd t="moneyType" class="hide">
            <label><input type="radio" name="r_money_type" value="day" checked="checked" /><span>日余额</span></label>
            <label><input type="radio" name="r_money_type" value="week" /><span>周余额</span></label>
            <label><input type="radio" name="r_money_type" value="month" /><span>月余额</span></label>
        </dd>
        <dt>方式：</dt>
        <dd>
            <label><input type="radio" name="r_status" checked="checked" value="3" /><span>增加</span></label>
            <label><input type="radio" name="r_status" value="4" /><span>扣除</span></label>
            <label><input type="radio" name="r_status" value="5" /><span>预充</span></label>
        </dd>
        <dt>金额：</dt>
        <dd><input type="text" name="r_money" class="fW30" /> 元</dd>
        <dt>备注：</dt>
        <dd><textarea name="r_comment" style="width:80%"></textarea></dd>
    </dl>
</div><!--/#tRechargeEditForm-->

<style type="text/css">
</style>
<div id="tPasswd">
    <dl class="dl2Col">
        <dt>旧密码：</dt>
        <dd><input name="old_passwd" type="password" class="fW150p" /></dd>
        <dt>新密码：</dt>
        <dd><input name="new_passwd" type="password" class="fW150p" /></dd>
        <dt>确认新密码：</dt>
        <dd><input name="new_passwd_2" type="password" class="fW150p" /></dd>
    </dl>
</div><!--/#tPasswd-->

<div id="tUserAddForm" style="width:550px;height:280px;">
    <input type="hidden" name="uid" />
    <dl class="dl2Col">
        <dt>登陆名称：</dt>
        <dd><input type="text" name="user_name" class="fW150p" /><span class="formTips">登陆名称长度最少<?php echo C('USER_NAME_MIN_LEN');?>个字符，最多<?php echo C('USER_NAME_MAX_LEN');?>个字符</span></dd>
        <dt>真实姓名：</dt>
        <dd><input type="text" name="contact" class="fW150p" /></dd>
        <dt>密码：</dt>
        <dd><input type="text" name="password" class="fW150p" /><span class="formTips">密码长度最少<?php echo C('PASSWD_MIN_LEN');?>个字符，最多<?php echo C('PASSWD_MAX_LEN');?>个字符</span></dd>
        <dt>QQ：</dt>
        <dd><input type="text" name="qq" class="fW150p" /></dd>
        <dt g="income_scale">提成比例：</dt>
        <dd g="income_scale"><input type="text" name="recommend_income_scale" class="fW150p" />% <span class="formTips">设置客服的提成比例</span></dd>
        <dt>会员类型：</dt>
        <dd>
            <label><input type="radio" name="type" value="3" checked="checked" /><span>站长客服</span></label>
            <label><input type="radio" name="type" value="4" /><span>广告主客服</span></label>
            <label><input type="radio" name="type" value="5" /><span>管理员</span></label>
        </dd>
        <dt>登陆状态：</dt>
        <dd>
            <label><input type="radio" name="status" value="2" checked="checked" /><span>允许登陆</span></label>
            <label><input type="radio" name="status" value="0" /><span>禁止登陆</span></label>
        </dd>
    </dl>
</div><!--/#tUserAddForm-->

<div id="tUserModifyForm" style="width:550px;height:280px;">
    <input type="hidden" name="uid" />
    <dl class="dl2Col">
        <dt>登陆名称：</dt>
        <dd><span name="user_name"></span></dd>
        <dt>真实姓名：</dt>
        <dd><input type="text" name="contact" class="fW150p" /></dd>
        <dt>密码：</dt>
        <dd><input type="text" name="password" class="fW150p" /><span class="formTips">如果不需修密码，请留空此处</span></dd>
        <dt>QQ：</dt>
        <dd><input type="text" name="qq" class="fW150p" /></dd>
        <dt g="income_scale">提成比例：</dt>
        <dd g="income_scale"><input type="text" name="recommend_income_scale" class="fW150p" />% <span class="formTips">设置客服的提成比例</span></dd>
        <dt>会员类型：</dt>
        <dd>
            <label><input type="radio" name="type" value="3" disabled="disabled" /><span>站长客服</span></label>
            <label><input type="radio" name="type" value="4" disabled="disabled" /><span>广告主客服</span></label>
            <label><input type="radio" name="type" value="5" disabled="disabled" /><span>管理员</span></label>
        </dd>
        <dt>登陆状态：</dt>
        <dd>
            <label><input type="radio" name="status" value="2" checked="checked" /><span>允许登陆</span></label>
            <label><input type="radio" name="status" value="0" /><span>禁止登陆</span></label>
        </dd>
    </dl>
</div><!--/#tUserModifyForm-->

</div><!--/.hide-->

<script>
function sendMessage(toUser) {
    toUser = toUser || '';
    Message.edit.add(toUser);
}

<?php $tmpLocalConf = include(APP_PATH . '../Public/Conf/local.php'); $tmpStatsWarnConf = array(); $tmpStatsWarnConfPre = 'stats_warn_conf_'; $tmpStatsWarnConfPreLen = strlen($tmpStatsWarnConfPre); foreach($tmpLocalConf as $k => $v) { $tmpKey = strtolower($k); if(substr($tmpKey, 0, $tmpStatsWarnConfPreLen) == $tmpStatsWarnConfPre) { if(substr($tmpKey, -3) == '_op') { continue; } $newKey = str_replace($tmpStatsWarnConfPre, '', $tmpKey); if(is_null($v) || strlen($v) < 1) { continue; } $tmpStatsWarnConf[$newKey] = array($tmpLocalConf[$k . '_op'], (float)$v); } } ?>

var statsWarnConf = <?php echo json_encode($tmpStatsWarnConf);?>;

function checkStatsWarn() {
    var groupKeyPre = 'g_';

    $.each(statsWarnConf, function(k, v) {
        var key = groupKeyPre + k,
            $o = $('[g=' + key + ']');

        $o.each(function(k2, v2){
            var $o2 = $(v2),
                code = $o2.html() + v[0] + v[1],
                result = eval(code);

                console.log(code + '=' + result);

            if(result) {
                var $td = $o2.parents('td'),
                    title = $td.attr('title') + v[0] + v[1] + '%';

                $o2.attr('title', title);
                $td.css('background-color', 'red');
            }
        }) 
    })
}

$(function(){
    var Config = {
        SITE_STATUS        : <?php echo (json_encode(C("SITE_STATUS"))); ?>,
        REDIRECT_APP       : '<?php echo C('REDIRECT_APP');?>',
        LOGIN_URL          : '<?php echo C('LOGIN_URL');?>',
        LOGOUT_TO_URL      : '<?php echo C('LOGOUT_TO_URL');?>',
        USER_NAME_MIN_LEN  : <?php echo C('USER_NAME_MIN_LEN');?>,
        USER_NAME_MAX_LEN  : <?php echo C('USER_NAME_MAX_LEN');?>,
        PASSWD_MIN_LEN     : <?php echo C('PASSWD_MIN_LEN');?>,
        PASSWD_MAX_LEN     : <?php echo C('PASSWD_MAX_LEN');?>,
        CURRENT_USER_TYPE  : <?php echo C('RUN_LOGIN_USER.type');?>,             //当前登陆会员的类型
        AD_TYPE            : <?php echo json_encode(C('AD_TYPE'));?>,
        AD_STATUS          : <?php echo json_encode(C('AD_STATUS'));?>,
        SITER_SERVICE_TYPE : 3,                                       //站长客服编号
        ADMIN_USER_TYPE    : 5                                        //管理员会员类型编号
    };

    <?php if(!empty($searchJson)): ?>Conf.set('searchDao', <?php echo ($searchJson); ?>);   //查询条件<?php endif; ?>

    Conf.set(Config);

    //Index.init();
    //User.init();
})
</script>
<script type="text/javascript" src="/res/admin/js/init.js"></script>
<script type="text/javascript" src="/res/admin/js/app.js"></script>

</body>
</html>